﻿#ifndef DRIVERSERVICE_H
#define DRIVERSERVICE_H
#include <typesdef.h>

#define DRIVER_FUNC_INSTALL     0x01
#define DRIVER_FUNC_REMOVE      0x02

#define MAXTHREADS 10
#define DRIVER_NAME       "cancel"
class DriverService
{
public:
    DriverService();

    BOOLEAN InstallDriver(
            IN SC_HANDLE  SchSCManager,
            IN LPCTSTR    DriverName,
            IN LPCTSTR    ServiceExe
            );
    BOOLEAN RemoveDriver(
            IN SC_HANDLE  SchSCManager,
            IN LPCTSTR    DriverName
            );
    BOOLEAN StartDriver(
            IN SC_HANDLE  SchSCManager,
            IN LPCTSTR    DriverName
            );
    BOOLEAN StopDriver(
            IN SC_HANDLE  SchSCManager,
            IN LPCTSTR    DriverName
            );
    BOOLEAN ManageDriver(
            IN LPCTSTR  DriverName,
            IN LPCTSTR  ServiceName,
            IN USHORT   Function
            );
    ULONG GetDriverManagerLastErrorCode();

private:
    //安装或卸载驱动,返回最后一次错误码
    DWORD err;
};

#endif // DRIVERSERVICE_H
